<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PinCRT: Mutex</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">PinCRT
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Mutex</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct__OS__APIS__MUTEX__TYPE.html">_OS_APIS_MUTEX_TYPE</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga638ee54875f26596da50328a20af8b82"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#ga638ee54875f26596da50328a20af8b82">OS_APIS_MUTEX_DEPTH_SIMPLE_INITIALIZER</a></td></tr>
<tr class="separator:ga638ee54875f26596da50328a20af8b82"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafd793fbefe953164dadf30802f293b9e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#gafd793fbefe953164dadf30802f293b9e">OS_APIS_MUTEX_DEPTH_RECURSIVE_INITIALIZER</a></td></tr>
<tr class="separator:gafd793fbefe953164dadf30802f293b9e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gababa2660f850ebc2c791de49f0cf8703"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="struct__OS__APIS__MUTEX__TYPE.html">_OS_APIS_MUTEX_TYPE</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#gababa2660f850ebc2c791de49f0cf8703">OS_MUTEX_TYPE_IMPL</a></td></tr>
<tr class="separator:gababa2660f850ebc2c791de49f0cf8703"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaef7ca0852181a3b3c9745d9d3ce45e42"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#gaef7ca0852181a3b3c9745d9d3ce45e42">OS_MutexInit</a> (volatile OS_MUTEX_TYPE *lock)</td></tr>
<tr class="separator:gaef7ca0852181a3b3c9745d9d3ce45e42"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0a8f7f4b5b90ed5a5817d490b0b9467d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#ga0a8f7f4b5b90ed5a5817d490b0b9467d">OS_MutexRecursiveInit</a> (volatile OS_MUTEX_TYPE *lock)</td></tr>
<tr class="separator:ga0a8f7f4b5b90ed5a5817d490b0b9467d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4b196034c3784f2938292ebd8f08ae2c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#ga4b196034c3784f2938292ebd8f08ae2c">OS_MutexDestroy</a> (volatile OS_MUTEX_TYPE *lock)</td></tr>
<tr class="separator:ga4b196034c3784f2938292ebd8f08ae2c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae9228ec7770c7df546748dc61a1c702d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#gae9228ec7770c7df546748dc61a1c702d">OS_MutexLock</a> (volatile OS_MUTEX_TYPE *lock)</td></tr>
<tr class="separator:gae9228ec7770c7df546748dc61a1c702d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7bf7a24aa6797e78a5c4464fc8f005d8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#ga7bf7a24aa6797e78a5c4464fc8f005d8">OS_MutexLockTid</a> (volatile OS_MUTEX_TYPE *lock, <a class="el" href="group__OS__APIS__TYPES.html#ga20167a3cedec6512ccdc030b50ee780b">NATIVE_TID</a> myTid)</td></tr>
<tr class="separator:ga7bf7a24aa6797e78a5c4464fc8f005d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga42d14da2dc5fea9a34eefe29c68f2ece"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#ga42d14da2dc5fea9a34eefe29c68f2ece">OS_MutexTryLock</a> (volatile OS_MUTEX_TYPE *lock)</td></tr>
<tr class="separator:ga42d14da2dc5fea9a34eefe29c68f2ece"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga44269b9d9f8f275b1357cc38a8b364c3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#ga44269b9d9f8f275b1357cc38a8b364c3">OS_MutexTryLockTid</a> (volatile OS_MUTEX_TYPE *lock0, <a class="el" href="group__OS__APIS__TYPES.html#ga20167a3cedec6512ccdc030b50ee780b">NATIVE_TID</a> myTid)</td></tr>
<tr class="separator:ga44269b9d9f8f275b1357cc38a8b364c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaae087bbdeb032a9c6b1c800d68ae279e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#gaae087bbdeb032a9c6b1c800d68ae279e">OS_MutexIsLocked</a> (volatile OS_MUTEX_TYPE *lock)</td></tr>
<tr class="separator:gaae087bbdeb032a9c6b1c800d68ae279e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab4c439cf86c9e545660138a756937069"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#gab4c439cf86c9e545660138a756937069">OS_MutexTimedLock</a> (volatile OS_MUTEX_TYPE *lock, UINT32 timeoutMillis)</td></tr>
<tr class="separator:gab4c439cf86c9e545660138a756937069"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab32e71fd2576d7a2cb71644d323784a6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#gab32e71fd2576d7a2cb71644d323784a6">OS_MutexTimedLockTid</a> (volatile OS_MUTEX_TYPE *lock0, <a class="el" href="group__OS__APIS__TYPES.html#ga20167a3cedec6512ccdc030b50ee780b">NATIVE_TID</a> myTid, UINT32 timeoutMillis)</td></tr>
<tr class="separator:gab32e71fd2576d7a2cb71644d323784a6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0c35e8a455039efb359a45edacc93dc0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__OS__APIS__TYPES.html#ga20167a3cedec6512ccdc030b50ee780b">NATIVE_TID</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#ga0c35e8a455039efb359a45edacc93dc0">OS_MutexGetOwner</a> (volatile OS_MUTEX_TYPE *lock)</td></tr>
<tr class="separator:ga0c35e8a455039efb359a45edacc93dc0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8b36189bf6a40cda48dd14bc909ec048"><td class="memItemLeft" align="right" valign="top">UINT32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#ga8b36189bf6a40cda48dd14bc909ec048">OS_MutexGetRecursionLevel</a> (volatile OS_MUTEX_TYPE *lock)</td></tr>
<tr class="separator:ga8b36189bf6a40cda48dd14bc909ec048"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7fbc5a1db4708f0360099fef9ab708b5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__OS__APIS__MUTEX.html#ga7fbc5a1db4708f0360099fef9ab708b5">OS_MutexUnlock</a> (volatile OS_MUTEX_TYPE *lock)</td></tr>
<tr class="separator:ga7fbc5a1db4708f0360099fef9ab708b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="gafd793fbefe953164dadf30802f293b9e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gafd793fbefe953164dadf30802f293b9e">&#9670;&nbsp;</a></span>OS_APIS_MUTEX_DEPTH_RECURSIVE_INITIALIZER</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define OS_APIS_MUTEX_DEPTH_RECURSIVE_INITIALIZER</td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">    {                                                  \</div>
<div class="line">        OS_APIS_MUTEX_IMPL_DEPTH_RECURSIVE_INITIALIZER \</div>
<div class="line">    }</div>
</div><!-- fragment --><p>Static initializer for a mutex. It is guaranteed that a (recursive) mutex initialized this way:</p>
<p>OS_MUTEX_TYPE mutex = OS_APIS_MUTEX_DEPTH_SIMPLE_INITIALIZER;</p>
<p>Will be initialized before any constuctor will be called.</p>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="ga638ee54875f26596da50328a20af8b82"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga638ee54875f26596da50328a20af8b82">&#9670;&nbsp;</a></span>OS_APIS_MUTEX_DEPTH_SIMPLE_INITIALIZER</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define OS_APIS_MUTEX_DEPTH_SIMPLE_INITIALIZER</td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">    {                                               \</div>
<div class="line">        OS_APIS_MUTEX_IMPL_DEPTH_SIMPLE_INITIALIZER \</div>
<div class="line">    }</div>
</div><!-- fragment --><p>Static initializer for a mutex. It is guaranteed that a (simple) mutex initialized this way:</p>
<p>OS_MUTEX_TYPE mutex = OS_APIS_MUTEX_DEPTH_SIMPLE_INITIALIZER;</p>
<p>Will be initialized before any constuctor will be called. Also, the static initializer for a simple mutex must be all zeros. This is because we want mutex that is initialized in a default way (all zeros according to the C++ standard) will be initialized correctly to a simple mutex.</p>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="gababa2660f850ebc2c791de49f0cf8703"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gababa2660f850ebc2c791de49f0cf8703">&#9670;&nbsp;</a></span>OS_MUTEX_TYPE_IMPL</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="struct__OS__APIS__MUTEX__TYPE.html">_OS_APIS_MUTEX_TYPE</a> <a class="el" href="group__OS__APIS__MUTEX.html#gababa2660f850ebc2c791de49f0cf8703">OS_MUTEX_TYPE_IMPL</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This type holds a representation of a mutex.</p>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga4b196034c3784f2938292ebd8f08ae2c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4b196034c3784f2938292ebd8f08ae2c">&#9670;&nbsp;</a></span>OS_MutexDestroy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void OS_MutexDestroy </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Destroys a mutex after it is no longer in use.</p>
<dl class="section note"><dt>Note</dt><dd>The behavior of a mutex after it was destroyed is undefined. It is the responsibility of the user to verify that no other thread is using the mutex when it comes to destroy it.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to destroy.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="ga0c35e8a455039efb359a45edacc93dc0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0c35e8a455039efb359a45edacc93dc0">&#9670;&nbsp;</a></span>OS_MutexGetOwner()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__OS__APIS__TYPES.html#ga20167a3cedec6512ccdc030b50ee780b">NATIVE_TID</a> OS_MutexGetOwner </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Queries the owner of a recursive mutex.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to query.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">NATIVE_TID</td><td>The owner of the mutex of INVALID_NATIVE_TID is the mutex is not locked.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The return value of this function is undefined for non-recursive (simple) mutex.</dd></dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="ga8b36189bf6a40cda48dd14bc909ec048"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8b36189bf6a40cda48dd14bc909ec048">&#9670;&nbsp;</a></span>OS_MutexGetRecursionLevel()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">UINT32 OS_MutexGetRecursionLevel </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Queries the recursion of a recursive mutex. I.e. the number of times that the unlock functions needs to be called before the mutex can be acquired by other thread.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to query.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">UINT32</td><td>The recursion level of the mutex.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>For non-recursive (simple) mutex, the return value of this function is 1 if the mutex is lock, or 0 if the mutex is unlocked.</dd></dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="gaef7ca0852181a3b3c9745d9d3ce45e42"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaef7ca0852181a3b3c9745d9d3ce45e42">&#9670;&nbsp;</a></span>OS_MutexInit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void OS_MutexInit </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Initialize a mutex. A mutex must be initialized before being used. Use this function to initialize the mutex or use one of the static initializers.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to initialize.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="gaae087bbdeb032a9c6b1c800d68ae279e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaae087bbdeb032a9c6b1c800d68ae279e">&#9670;&nbsp;</a></span>OS_MutexIsLocked()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a> OS_MutexIsLocked </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Checks whether a mutex state is locked.<br  />
Doesn't affect the mutex state and doesn't block.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to check.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">TRUE</td><td>If the mutex is locked.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="gae9228ec7770c7df546748dc61a1c702d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae9228ec7770c7df546748dc61a1c702d">&#9670;&nbsp;</a></span>OS_MutexLock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void OS_MutexLock </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Aquire a mutex, blocks until the mutex becomes available (according to the mutex's semantics).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to acquire.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="ga7bf7a24aa6797e78a5c4464fc8f005d8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7bf7a24aa6797e78a5c4464fc8f005d8">&#9670;&nbsp;</a></span>OS_MutexLockTid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void OS_MutexLockTid </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__OS__APIS__TYPES.html#ga20167a3cedec6512ccdc030b50ee780b">NATIVE_TID</a>&#160;</td>
          <td class="paramname"><em>myTid</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Aquire a mutex, blocks until the mutex becomes available (according to the mutex's semantics). This function is similar to <a class="el" href="group__OS__APIS__MUTEX.html#gae9228ec7770c7df546748dc61a1c702d">OS_MutexLock()</a> except that it accept as an argument the thread ID of the thread that want to acquire the lock (which is usually the current thread).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to acquire. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">tid</td><td>The thread ID of the thread that wants to acquire the mutex. This argument can be INVALID_NATIVE_TID if the thread ID is not known (e.g. in a mutex of type OS_MUTEX_DEPTH_SIMPLE).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="ga0a8f7f4b5b90ed5a5817d490b0b9467d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0a8f7f4b5b90ed5a5817d490b0b9467d">&#9670;&nbsp;</a></span>OS_MutexRecursiveInit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void OS_MutexRecursiveInit </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Initialize a recursive mutex. A mutex must be initialized before being used. Use this function to initialize a recursive mutex or use one of the static initializers.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to initialize.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="gab4c439cf86c9e545660138a756937069"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab4c439cf86c9e545660138a756937069">&#9670;&nbsp;</a></span>OS_MutexTimedLock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a> OS_MutexTimedLock </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UINT32&#160;</td>
          <td class="paramname"><em>timeoutMillis</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Aquire a mutex, blocks until the mutex becomes available (according to the mutex's semantics). or 'timeoutMillis' milli seconds passed. When 'timeoutMillis' is zero, this function is identical to <a class="el" href="group__OS__APIS__MUTEX.html#ga42d14da2dc5fea9a34eefe29c68f2ece">OS_MutexTryLock()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to acquire. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeoutMillis</td><td>The timeout to block.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">TRUE</td><td>If the mutex is locked. FALSE If the timeout was expired and the mutex can't be acquired during that time.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="gab32e71fd2576d7a2cb71644d323784a6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab32e71fd2576d7a2cb71644d323784a6">&#9670;&nbsp;</a></span>OS_MutexTimedLockTid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a> OS_MutexTimedLockTid </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__OS__APIS__TYPES.html#ga20167a3cedec6512ccdc030b50ee780b">NATIVE_TID</a>&#160;</td>
          <td class="paramname"><em>myTid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UINT32&#160;</td>
          <td class="paramname"><em>timeoutMillis</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Aquire a mutex, blocks until the mutex becomes available (according to the mutex's semantics). or 'timeoutMillis' milli seconds passed. When 'timeoutMillis' is zero, this function is identical to <a class="el" href="group__OS__APIS__MUTEX.html#ga42d14da2dc5fea9a34eefe29c68f2ece">OS_MutexTryLock()</a>. This function is similar to <a class="el" href="group__OS__APIS__MUTEX.html#gab4c439cf86c9e545660138a756937069">OS_MutexTimedLock()</a> except that it accept as an argument the thread ID of the thread that want to acquire the lock (which is usually the current thread).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to acquire. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeoutMillis</td><td>The timeout to block. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">tid</td><td>The thread ID of the thread that wants to acquire the mutex. This argument can be INVALID_NATIVE_TID if the thread ID is not known (e.g. in a mutex of type OS_MUTEX_DEPTH_SIMPLE).</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">TRUE</td><td>If the mutex is locked. FALSE If the timeout was expired and the mutex can't be acquired during that time.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="ga42d14da2dc5fea9a34eefe29c68f2ece"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga42d14da2dc5fea9a34eefe29c68f2ece">&#9670;&nbsp;</a></span>OS_MutexTryLock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a> OS_MutexTryLock </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Tries to aquire a mutex:<br  />
</p><ul>
<li>If the mutex is available, acquire it and return true.<br  />
</li>
<li>Otherwise, return false.</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to acquire.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">TRUE</td><td>If the mutex was acquired.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="ga44269b9d9f8f275b1357cc38a8b364c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga44269b9d9f8f275b1357cc38a8b364c3">&#9670;&nbsp;</a></span>OS_MutexTryLockTid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a> OS_MutexTryLockTid </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__OS__APIS__TYPES.html#ga20167a3cedec6512ccdc030b50ee780b">NATIVE_TID</a>&#160;</td>
          <td class="paramname"><em>myTid</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Tries to aquire a mutex:<br  />
</p><ul>
<li>If the mutex is available, acquire it and return true.<br  />
</li>
<li>Otherwise, return false. This function is similar to <a class="el" href="group__OS__APIS__MUTEX.html#ga42d14da2dc5fea9a34eefe29c68f2ece">OS_MutexTryLock()</a> except that it accept as an argument the thread ID of the thread that want to acquire the lock (which is usually the current thread).</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to acquire. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">tid</td><td>The thread ID of the thread that wants to acquire the mutex. This argument can be INVALID_NATIVE_TID if the thread ID is not known (e.g. in a mutex of type OS_MUTEX_DEPTH_SIMPLE).</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">TRUE</td><td>If the mutex was acquired.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
<a id="ga7fbc5a1db4708f0360099fef9ab708b5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7fbc5a1db4708f0360099fef9ab708b5">&#9670;&nbsp;</a></span>OS_MutexUnlock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__OS__APIS__TYPES.html#gad312c486942310e24394e7ea81f8f7e1">BOOL_T</a> OS_MutexUnlock </td>
          <td>(</td>
          <td class="paramtype">volatile OS_MUTEX_TYPE *&#160;</td>
          <td class="paramname"><em>lock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Releases a mutex.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">lock</td><td>The mutex to release.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">TRUE</td><td>If the mutex was locked and as a result of this call was unlocked.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><ul>
<li><b>O/S</b>: Windows, Linux &amp; macOS*</li>
<li><b>CPU:</b> All </li>
</ul>
</dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
